/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package my.algorithms.mcorrea;

import java.util.UUID;

/**
 *
 * @author mcorrea
 */
public class Product implements Comparable<Product> {
	
	private UUID id;
	private String name;

	public Product(String name) {
		this.id = UUID.randomUUID();
		this.name = name; 
	}

	public UUID getId() {
		return id;
	}

	public void setId(UUID id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public boolean equals(Object obj) {
		return ((Product)obj).getId().equals(id);
	}

	@Override
	public int hashCode() {
		return this.id.hashCode();
	}

	@Override
	public int compareTo(Product o) {
		return o.getId().compareTo(id);
	}

	@Override
	public String toString() {
		return "Product{" + "id=" + id + ", name=" + name + '}';
	}
	
	
	
	
	
	
	
}
